# 1. 创建英法词典e2f并打印
e2f = {'dog': 'chien', 'cat': 'chat', 'walrus': 'morse'}
print("1. e2f字典：", e2f)

# 2. 打印walrus对应的法语单词
print("2. walrus的法语：", e2f['walrus'])

# 3. 从e2f创建法英词典f2e（使用items方法）
f2e = {french: english for english, french in e2f.items()}
print("3. f2e字典：", f2e)

# 4. 打印f2e的值
print("4. f2e的值：", list(f2e.values()))

# 5. 打印chien对应的英语单词
print("5. chien的英语：", f2e['chien'])

# 6. 用字典推导式创建dic
dic = {key: key * 10 for key in range(4)}
print("6. dic字典：", dic)

# 7. 遍历dic并以“key : value”格式打印
print("7. dic的键值对：")
for key, value in dic.items():
    print(f"{key} : {value}")

# 8. 打印e2f中的英语单词集合
english_words = set(e2f.keys())
print("8. e2f中的英语单词集合：", english_words)

# 9. 用集合推导式创建奇数集合odd
odd = {num for num in range(10) if num % 2 != 0}
print("9. 奇数集合odd：", odd)

# 10. 使用zip()创建字典
keys = ('optimist', 'pessimist', 'troll')
values = ('The glass is half full', 'The glass is half empty', 'How did you get a glass?')
result_dict = dict(zip(keys, values))
print("10. 用zip创建的字典：", result_dict)